<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@page import="Model_Db.DbUtil"%>
<%@page import="java.sql.*" %>
<%@page import="java.util.*" %>
<%@page import="java.text.DecimalFormat" %>
<%@page import="java.util.stream.Collectors" %>
<%@page import="util.*" %>
<!DOCTYPE html>
<html>
<head>
	<meta charset="UTF-8">
	<meta http-equiv="X-UA-Compatible" content="IE=edge">
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<title>家属的界面</title>
	<script src="js/jquery-3.4.1.min.js"></script>
	<style>
		ul{
		list-style-type:none;
		}
		li{
		padding-left:0px;
		}
		.mydiv{
		width:300px;
		height:300px;
		border-radius:50%;
		overflow:hidden;
		}
		.mydiv1{
		width:130px;
		height:130px;
		
		overflow:hidden;
		}
	</style>
	<link href="css/style_two.css" rel="stylesheet" type="text/css">
	<link href="css/style_one.css" rel="stylesheet" type="text/css">
	<link rel="stylesheet" href="src/css/dialog.css">
</head>
<body>
<!-- header模块 -->
	<div class="container"> 
  		<!-- Header -->
  		<header class="header">
    		<h4 class="logo"><img alt="logo" src="image/logo.png" width="70px" height="70px">辽宁科技学院医务所</h4>
  		</header>
<!-- header模块 -->	
  		
  		
<!-- 病人个人信息模块 -->
		<section class="intro" style="width:100%;height:400px">
			<jsp:useBean id="abc" class="Model_Db.DbUtil" ></jsp:useBean>
		    <% 	request.setCharacterEncoding("UTF-8");
		    	/* request.getAttribute("ID"); */
		    	String sql="select * from t_patient where ID="+"'"+request.getParameter("id")+"'"+" or Tel_Number="+"'"+request.getParameter("id")+"'";
				ResultSet rs=abc.QuerySQL(sql);
				rs.last();
			%>
		    <div class="column">
		    	
			      <h3>病人头像</h3>
			      
			      <img src="<%=rs.getString("Img_Path") %> " alt="这里是病人头像"  class="mydiv" >
			      
		    </div>
		    <div class="column">
		    		<h2><font color="blue">个人信息</font></h2>
		    		<h3>身份证号：<%=rs.getString("ID") %></h3>
		     		<h3>姓名：<%=rs.getString("Name") %></h3>
		     		<h3>年龄：<%=rs.getString("Age") %></h3>
		     		<h3>性别：<%=rs.getString("Sex") %></h3>
		     		<h3>电话：<%=rs.getString("Tel_Number") %></h3>
		     		<h3>病号数：<%=rs.getString("Num_Patient") %></h3>
		    </div>

		</section>
  	<hr>
<!-- 病人个人信息模块 -->
  	
  	
 
<!-- 医生信息模块 -->
	 <div class="row">
	      <div class="col-xs-7">
	        	<div class="media">
	        	<jsp:useBean id="doc" class="Model_Db.DbUtil" ></jsp:useBean>
	        	<% 		
		        	request.setCharacterEncoding("UTF-8");
	        	    String sql_findDoc="select ch_doctorid,MAX(ch_date) from  t_casehistory where t_casehistory.ch_patientid=(select t_patient.ID from t_patient where t_patient.ID='"+request.getParameter("id")+"' or t_patient.Tel_Number='"+request.getParameter("id")+"')";
					ResultSet rs_find=doc.QuerySQL(sql_findDoc);
					rs_find.last();
					String sql_doc="select * from t_doctor where D_Id='"+rs_find.getString("ch_doctorid")+"'";
					ResultSet rs_doctor=doc.QuerySQL(sql_doc);
					rs_doctor.last();
				%>
	          	<div class="media-left"> <a href="#"> <img  src=<%=rs_doctor.getString("D_Picture")%> class="mydiv1" alt="..."> </a> </div>
	          	<div class="media-body">
	            		<h2 class="media-heading">主治医生信息</h2>
	            		<p><%=rs_doctor.getString("Other") %></p>
	            </div>
	        	</div>
	       </div>
	       <div class="col-xs-5">
	       		<div class="row">
	       			<br><br>
	       			<div class="col-lg-6">
	       				<% String tel=rs_doctor.getString("D_Tel"); 
		       				String one=tel.substring(0, 3); 
		       				String two=tel.substring(3, 7); 
		       				String three=tel.substring(7); %>
	       				<h4 align="right">电话 : <%=one+"-"+two+"-"+three%></h4>
	       			</div>
	       			<div class="col-lg-6">
	       				<h4 align="right">邮箱 : <%=rs_doctor.getString("D_Email") %></h4>
	       			</div>
	       			<div class="col-lg-6">
	       				<h4 align="right">反馈电话 : 123-456-7890</h4>
	       			</div>
	       			<div class="col-lg-6">
	       				<h4 align="right">客服在线资讯 : 123-456-7890</h4>
	       			</div>
	       		</div>
	       </div>
	 </div>
 	<hr>
<!-- 医生信息模块 -->
 	
 
<!-- 健康小知识模块 -->
 	<p class="tag"><h2>健康小知识</h2></p>
	<div class="gallery">
	   	<div class="thumbnail"> <a href="https://zhidao.baidu.com/question/922881019730196579.html" target="blank"><img src="image/水果.jpeg" alt="iamge/fruit" width="2000" class="cards"/></a>
		   	  <p class="tag" >水果营养与健康知识：水果的分类</p>
		      <p class="text_column" >第一类，含糖量较高的水果，有柿子、桂圆、香蕉、杨梅、石榴等。这类水果的含糖量往往在15%以上，糖尿病患者对于此类水果是绝对不建议吃的。对于血糖正常的人来说，我们也应该尽量少吃这些高糖水果。</p>
		      <p class="text_column" >第二类，含糖量较低的水果，有番石榴、木瓜、雪莲果、柚子、樱桃、苹果等。这些低糖水果多用于糖尿病患者的食用，在生活中就算不小心多吃也不用担心会肥胖或者是血糖升高。同时，低糖水果还具有降火的功效，因此经常上火的人群也可以多吃些低糖水果。</p>
		      <p class="text_column" ><b>等等.......点击图片查看</b></p>
	    </div>
	    <div class="thumbnail"> <a href="https://www.sohu.com/a/292287214_822499" target="blank"><img src="image/健康睡眠.jpeg" alt="sleep_jpeg" width="2000" class="cards"/></a>
		      <p class="tag" >健康睡眠</p>
		      <p class="text_column" >1、睡觉前要注意足部的保暖。</p>
		      <p class="text_column" >2、一般来说，比较适合睡眠的室内温度在20℃~30℃之间。</p>
		      <p class="text_column" >3、最佳睡觉时间：亥时(21-23点)至寅时(3-5点)末，即：晚上21点睡下，早晨5点起床。</p>
		      <p class="text_column" >4、适当体育锻炼增强体质，可减轻躯体疲劳感，对睡眠有利，但运动量不宜过大，过度疲劳反而影响睡眠。睡前三小时吃东西会胖,加强自我放松训练，对于减轻焦虑情绪有效，如果失眠严重的患者，希望尽早就医，用科学的方法来解决失眠这个问题。</p>
		      <p class="text_column" ><b>等等.......点击图片查看</b></p>
	    </div>
	    <div class="thumbnail"> <a href="https://baike.baidu.com/item/28%E4%B8%AA%E4%B8%8D%E5%8F%AF%E4%B8%8D%E7%9F%A5%E7%9A%84%E5%81%A5%E5%BA%B7%E9%A5%AE%E9%A3%9F%E5%B0%8F%E5%B8%B8%E8%AF%86/15645841?fr=aladdin" target="blank"><img src="image/健康饮食.jpg" alt="food_jpg" width="2000" class="cards"/></a>
		      <p class="tag" >生活健康饮食小常识</p>
		      <p class="text_column" >1、常吃宵夜，会得胃病，因为胃得不到休息、一个星期只能吃4颗蛋，吃太多对身体不好、鸡屁股和脖子淋巴较多，含有致癌物，不吃较好、饭后吃水果是错误的观念，应是饭前吃水果</p>
		      <p class="text_column" >2、喝豆浆时不要加鸡蛋及红糖，也不要喝太多、空腹时不要吃蕃茄，最好饭后吃、早上醒来喝一杯水预防结石、睡前三小时吃东西会胖</p>
		      <p class="text_column" >3、少喝奶茶，因为高热量、高油，长期饮用易罹患高血压、糖尿病等疾病、刚出炉的面包不宜马上食用、每天十杯水，膀胱癌不会来,睡前三小时吃东西会胖</p>
		      <p class="text_column" ><b>等等.......点击图片查看</b></p>
	    </div>
	    <div class="thumbnail"> <a href="https://jingyan.baidu.com/article/3f16e003f33a472591c10384.html" target="blank"><img src="image/运动.jpg" alt="sport_jpg" width="2000" class="cards"/></a>
		      <p class="tag" >健康运动小知识</p>
		      <p class="text_column" >1、饭前饭后不宜做剧烈运动。许多人认为空腹运动容易消耗人体的脂肪，饭后运动，促进消化，有利于减肥，这种观点是错误的。大家都知道运动是是要消耗血糖的，而人体的血糖要维持在一个适当的水平才能满足各种机能的实现，长期低血糖容易发生头晕恶心、并对肠胃造成很大影响。所以运动前需吃高热量低脂肪的食物，不可空腹运动。饭后运动，此时人体的肠胃进入忙碌的工作状态，需要血液源源不断的供应能量，如果此时进行剧烈的运动，会导致肠胃的供血不足，肠胃蠕动减少...</p>
		      <p class="text_column" ><b>等等.......点击图片查看</b></p>
	    </div>
	</div>
<!-- 健康小知识模块 -->
	
	
<!-- 显示病人状态的窗口 -->
	<script type="text/javascript">
		function a(){
			alert("dasda");
			return;
		}
	
	</script>
	<div class="col-sm-8 col-lg-7">
	        <h2>病人病情情况</h2>
	        <jsp:useBean id="c" class="Model_Db.DbUtil" ></jsp:useBean>
	        <%  request.setCharacterEncoding("UTF-8");
	        String sql_casehistory="select MAX(ch_date) from  t_casehistory where t_casehistory.ch_patientid=(select t_patient.ID from t_patient where t_patient.ID='"+request.getParameter("id")+"' or t_patient.Tel_Number='"+request.getParameter("id")+"')";
	        ResultSet rs_casehistory=c.QuerySQL(sql_casehistory);
	        rs_casehistory.last();
	        %>
	        <hr>
	        <div class="row">
	        	<div class="col-xs-6"><h4>Patient's current situation</h4></div>
	        	<div class="col-xs-6">
	        	  <h4 class="text-right">更新时间:<%=rs_casehistory.getString("MAX(ch_date)") %></h4>
	        	</div>
	        </div>
	        
	        	<div style="height:230px;">
	        		<script language="javascript">
						function ShowDiv(objid)
						{
						document.getElementById(objid).style.display="block";
						}
						function Hidden(objid)
						{
						document.getElementById(objid).style.display="none";
						}
					</script>
	        		<div style="width:100%;height:220px;" id="div0">
                         <div style="width:20%;height:220px;background-color:#E3E4E5;float:left;">
                         	<div style="width:97%;height:70px;background-color:#B1C3C8;margin:2.5px;line-height:70px;text-align:center"><a href="javascript:void(0)" onclick="ShowDiv('div2');Hidden('div3');Hidden('div4')" ><span><font size="5">既往病例</font></span></a></div>
                         	<div style="width:97%;height:70px;background-color:#B1C3C8;margin:2.5px;line-height:70px;text-align:center"><a href="javascript:void(0)" onclick="ShowDiv('div3');Hidden('div2');Hidden('div4')"><span><font size="5">最新情况</font></span></a></div>
                         	<div style="width:97%;height:70px;background-color:#B1C3C8;margin:2.5px;line-height:70px;text-align:center"><a href="javascript:void(0)" onclick="ShowDiv('div4');Hidden('div3');Hidden('div2')"><span><font size="5">频繁病症</font></span></a></div>
                         </div>            
						 <div style="width:80%;height:220px;background-color:#B9BBBA;float:left;overflow-y:scroll">
						 	<div style="display:none;text-align:center;margin-left:10%;margin-right:10%;" id="div2" >
							 	<jsp:include page="Past_cases.jsp">
							 		<jsp:param value="<%=request.getParameter(\"id\") %>" name="patient_id"/>
							 	</jsp:include>
						 	</div>
						 	<div style="text-align:center;margin-left:10%;margin-right:10%;" id="div3" >
							 	<jsp:include page="New_past_case.jsp">
							 		<jsp:param value="<%=request.getParameter(\"id\") %>" name="patient_id"/>
							 	</jsp:include>
						 	</div>
						 	<div style="display:none;text-align:center;margin-left:0;margin-right:0;" id="div4" >
							 	<jsp:include page="analysis_chart.jsp">
							 		<jsp:param value="<%=request.getParameter(\"id\") %>" name="patient_id"/>
							 	</jsp:include>
						 	</div>

						 </div>
                    </div>    	
	        	</div>	        	        
	</div>
<!-- 显示病人状态的窗口 -->
	
	



	
	
<!-- 状态分析统计人数 -->
	<div class="col-sm-4 col-lg-5">
			<!-- 统计数据库里的病人信息 -->
			<jsp:useBean id="a" class="Model_Db.DbUtil" ></jsp:useBean>
			<%
			String sql_all="select * from t_patient";
			ResultSet rs_all=a.QuerySQL(sql_all);
			rs_all.last();
			%>
			<p>
	        	<h2>病例统计：<%=rs_all.getRow() %>人</h2>
	        	<hr>
	        	<div class="mt20"><button id="sendMsgNoHide">下列数据说明</button>
		        	<jsp:useBean id="e" class="Model_Db.DbUtil" ></jsp:useBean>
		        	<% 
		        	request.setCharacterEncoding("UTF-8");
					String sql_clinicaldiagnosis="select ch_clinicaldiagnosis from t_casehistory";
					ResultSet rs_clinicaldiagnosis=e.QuerySQL(sql_clinicaldiagnosis);
					rs_clinicaldiagnosis.last();
					rs_clinicaldiagnosis.beforeFirst();
		        	List<String> list_clinicaldiagnosis=new ArrayList<String>();//所有病名
		        	List<String> list_clinicaldiagnosisall;//不重复元素
					while(rs_clinicaldiagnosis.next()){
						String clinicaldiagnosis=rs_clinicaldiagnosis.getString("ch_clinicaldiagnosis");
						list_clinicaldiagnosis.add(clinicaldiagnosis);
					}
					HashSet hSet = new HashSet(list_clinicaldiagnosis);
					list_clinicaldiagnosis.clear();
					list_clinicaldiagnosis.addAll(hSet);
					%>
					<select onchange="test()" id="select0" style="width: 150px;height:30px;float:right"> 
					<% 
					for(int i=0;i<list_clinicaldiagnosis.size();i++){ 
					%>
					<option value="<%=list_clinicaldiagnosis.get(i) %>"><%=list_clinicaldiagnosis.get(i) %></option> 
					<%} %>
					</select> 
	        	</div>
			    <script src="http://www.jq22.com/jquery/jquery-1.10.2.js"></script>
				<script src="src/jquery.dialog.js"></script>
				<script>
				    // 发送提示（不隐藏）
				    $('#sendMsgNoHide').on('click', function() {
				      $.sendMsg('第一行数据代表：排除病例占总人数的百分比;<br>第二行数据代表：治愈人数占总人数的百分比;<br>第三行数据代表：轻度患者占总人数的百分比;<br>第四行数据代表：中度患者占总人数的百分比;<br>第五行数据代表：重度患者占总人数的百分比;<br>第六行数据代表：死亡人数占总人数的百分比;', false, function() {
				        console.log('sendMsg closed');
				      });
				    });
				</script>
			<script>
			function test(){
				var a = $("#a");
				var b = $("#b");
				var c = $("#c");
				var d = $("#d");
				var e = $("#e");
				var f = $("#f");
				var g = $("#g");
				var a1 = $("#a1");
				var b2 = $("#b2");
				var c3 = $("#c3");
				var d4 = $("#d4");
				var e5 = $("#e5");
				var f6 = $("#f6");
				var sel = document.getElementById("select0").value;
				$.get("paramservlet",{sel:sel},function(data){
					data=JSON.parse(data);
					a.css("width",data.str_normal);
					b.css("width",data.str_cure);
					c.css("width",data.str_mild);
					d.css("width",data.str_moderate);
					e.css("width",data.str_severe);
					f.css("width",data.str_dead);
					a1.html(data.str_normal);
					b2.html(data.str_cure);
					c3.html(data.str_mild);
					d4.html(data.str_moderate);
					e5.html(data.str_severe);
					f6.html(data.str_dead);
				},"json")
				}
			</script>
			</p>
<!-- 状态分析统计人数 -->





<!-- 计算数据 -->
			<jsp:useBean id="d" class="Model_Db.DbUtil" ></jsp:useBean>
			<%  
				request.setCharacterEncoding("UTF-8");
				String sql_symptoms="select * from t_casehistory where ch_clinicaldiagnosis='"+list_clinicaldiagnosis.get(0)+"'";
				ResultSet rs_symptom=d.QuerySQL(sql_symptoms);
				rs_symptom.last();
				rs_symptom.beforeFirst();
				List<String> list=new ArrayList<String>();
				while(rs_symptom.next()){
					String symptom=rs_symptom.getString("ch_Degree_symptoms");
					list.add(symptom);
				}
				rs_symptom.last();
				float all=rs_symptom.getRow();
				float cured=0;
				float milded=0;
				float moderated=0;
				float severed=0;
				float deaded=0;
				float normaled=0;
				for(int i=0;i<rs_symptom.getRow();i++){
				if(list.get(i).equals("已治愈")==true){
					cured=cured+1;
					continue;
				}
				if(list.get(i).equals("轻度")==true){
					milded=milded+1;
					continue;
				}
				if(list.get(i).equals("中度")==true){
					moderated=moderated+1;
					continue;
				}
				if(list.get(i).equals("重度")==true){
					severed=severed+1;
					continue;
				}
				if(list.get(i).equals("死亡")==true){
					deaded=deaded+1;
					continue;
				}
				if(list.get(i).equals("正常")==true){
					normaled=normaled+1;
				}
				}
				float cure=(cured/(all-normaled))*100;
				float mild=(milded/(all-normaled))*100;
				float moderate=(moderated/(all-normaled))*100;
				float severe=(severed/(all-normaled))*100;
				float dead=(deaded/(all-normaled))*100;
				float normal=(normaled/all)*100;
				
				DecimalFormat decimalFormat = new DecimalFormat("0.00");
				String str_normal=decimalFormat.format(normal)+"%";
				String str_cure=decimalFormat.format(cure)+"%";
				String str_mild=decimalFormat.format(mild)+"%";
				String str_moderate=decimalFormat.format(moderate)+"%";
				String str_severe=decimalFormat.format(severe)+"%";
				String str_dead=decimalFormat.format(dead)+"%";
				
			
			%>
<!-- 计算数据 -->






<!-- 数据可视化模块 -->
	        <div class="progress">
	          	<div id="a" class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="85" aria-valuemin="0" aria-valuemax="100" style="width:<%=str_normal %>"><span id="a1"><%=str_normal %></span></div>
	        </div>
	        <div class="progress">
	          	<div id="b" class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="80" aria-valuemin="0" aria-valuemax="100" style="width:<%=str_cure %>"><span id="b2"><%=str_cure %></span></div>
	        </div>
	        <div class="progress">
	          	<div id="c" class="progress-bar progress-bar-success" role="progressbar" aria-valuenow="70" aria-valuemin="0" aria-valuemax="100" style="width:<%=str_mild %>"><span id="c3"><%=str_mild %></span></div>
	        </div>
	        <div class="progress">
	          	<div id="d" class="progress-bar progress-bar-warning" role="progressbar" aria-valuenow="60" aria-valuemin="0" aria-valuemax="100" style="width:<%=str_moderate %>"><span id="d4"><%=str_moderate %></span></div>
	        </div>
	        <div class="progress">
	          	<div id="e" class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="55" aria-valuemin="0" aria-valuemax="100" style="width:<%=str_severe %>"><span id="e5"><%=str_severe %></span></div>
	        </div>
	        <div class="progress">
	          	<div id="f" class="progress-bar progress-bar-danger" role="progressbar" aria-valuenow="50" aria-valuemin="0" aria-valuemax="100" style="width:<%=str_dead %>"><span id="f6"><%=str_dead %></span></div>
	        </div>
	        <br><br>
	</div>
<!-- 数据可视化模块 -->


<!--  新闻资讯模块 -->
	<hr>
    <h2 align="center"><font color="orange">新闻</font>·<font color="skyblue">资讯</font></h2>
    <hr>
    <div class="row">
	      <div class="col-lg-6">  
	        <ul align="center">
		          <li><a href="http://xinwen.qqyy.com/a/161220/106eb.html" target="blank"><font color="orange">国人胃病发生率达85% 胃的问题可能与脾相关</font></a></li>
		          <hr>
		          <li><a href="http://xinwen.qqyy.com/a/161219/106e2.html" target="blank"><font color="orange">广州将行全民健身五年计划 常锻炼人数将达790万</font></a></li>
		          <hr>
		          <li><a href="http://xinwen.qqyy.com/a/161220/106ec.html" target="blank"><font color="orange">近半数强迫症首次发病于青少年时期 多因素可诱发</font></a></li>
		          <hr>
		          <li><a href="http://xinwen.qqyy.com/a/161216/106de.html" target="blank"><font color="orange">研究称两岁孩子就能辨别大人说谎&nbsp;&nbsp;&nbsp;</font></a><a href="http://xinwen.qqyy.com/jbyw/" target="blank"><font color="orange">更多>></font></a></li>
		          <hr>        
	        </ul>
	      </div>
	      <div class="col-lg-6">
	        <ul align="center">
		          <li><a href="http://xinwen.qqyy.com/a/161220/106ea.html" target="blank">陕西：门诊不得拒绝二类疫苗接种者</a></li>
		          <hr>
		          <li><a href="http://xinwen.qqyy.com/a/161219/106e3.html" target="blank">吉林长春：提高职工医保报销封顶线</a></li>
		          <hr>
		          <li><a href="http://xinwen.qqyy.com/a/161216/106dd.html" target="blank">山西：对公立医院体外诊断试剂实行限价采购</a></li>
		          <hr>
		          <li><a href="http://xinwen.qqyy.com/a/161216/106d9.html" target="blank">人社部：年底基本实现医保全国联网&nbsp;&nbsp;&nbsp;</a><a href="http://xinwen.qqyy.com/ylzx/" target="blank">更多>></a></li>
		          <hr>
	        </ul>
	      </div>
    </div>
    </div>
<!--  新闻资讯模块 -->


<!-- 结束区 -->
    <footer id="contact">
	    <p class="hero_header">知不知道，你很重要</p>
	    <div class="button"><a href="登入窗口.jsp"><font color="white">GO BACK</font></a></div>
    </footer>
    <!-- Copyrights Section -->
	<div class="copyright">&copy;<strong>辽科医务管理系统</strong></div>
	<hr>
<!-- 结束区 -->
</body>
</html>